<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml">
	<ui:define name="head">
		<title>日报</title>
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style type="text/css">
.ui-datatable-scrollable-header-box {
	margin-left: 0px;
	margin-right: 15px !important;
}

iframe {
	width: 100%;
	height: 600px;
}

.ui-datalist-empty-message {
	/* height: 100px; */
	min-height: 100px;
}

.ui-datalist-content {
	/* height: 100px; */
	min-height: 100px;
}

.yes {
	color: red;
}

.no {
	color: green;
}
</style>
	</ui:define>
	<ui:define name="content">
		<!-- 通道及装置告警 -->
		<div class="box box-solid with-border">
			<div class="nav-tabs-custom" id="alarm1" style="position: relative">
				<ul class="nav nav-tabs pull-left">
					<li class="active"><a onclick="refresh1();"
						href="#InterruptAlarm" data-toggle="tab">保护通道告警</a></li>
					<li><a onclick="refresh2();" href="#ProtectDevice"
						data-toggle="tab">保护装置告警</a></li>
					<li><a onclick="refresh3();" href="#protectChannel"
						data-toggle="tab">通信通道告警</a></li>
				</ul>
				<h:form>
					<p:remoteCommand name="refresh1" update="form1"
						oncomplete="getTableScrollHeight();"
						action="#{protectInterruptAlarmController.refreshPage}"></p:remoteCommand>
					<p:remoteCommand name="refresh2" update="form2"
						oncomplete="getTableScrollHeight();"
						action="#{protectDeviceAlarmComtroller.refreshPage}"></p:remoteCommand>
					<p:remoteCommand name="refresh3" update="form3"
						oncomplete="getTableScrollHeight();"
						action="#{protectChannelAlarmController.refreshPage}"></p:remoteCommand>
				</h:form>
				<div class="tab-content no-padding">
					<p:growl id="msgs" showDetail="true" />
					<!-- 保护通道告警 -->
					<div id="InterruptAlarm" class="chart tab-pane active">
						<h:form id="form1">
							<div class="box box-solid with-border">
								<div class="box-header">
									<p:outputLabel for="popup1" value="告警时间：" />
									<p:calendar id="popup1" navigator="true"
										value="#{protectInterruptAlarmController.queryDate1}"
										pattern="yyyy-MM-dd" maxdate="Date()">
										<p:ajax event="dateSelect"
											listener="#{protectInterruptAlarmController.onDateSelectStart}" />
									</p:calendar>
									<p:outputLabel for="popup2" value="至 " />
									<p:calendar id="popup2" navigator="true"
										value="#{protectInterruptAlarmController.queryDate2}"
										pattern="yyyy-MM-dd" maxdate="Date()">
										<p:ajax event="dateSelect"
											listener="#{protectInterruptAlarmController.onDateSelectEnd}" />
									</p:calendar>
									<p:commandButton value="查询" id="query2"
										update="interruptAlarmTable" icon="ui-icon-search"
										actionListener="#{protectInterruptAlarmController.queryByTime}"
										style="margin-left:10px;" oncomplete="getTableScrollHeight();">
									</p:commandButton>
									<p:commandButton icon="ui-icon-refresh" value="重置"
										actionListener="#{protectInterruptAlarmController.resetQuery}"
										style="margin-left:5px;" oncomplete="getTableScrollHeight();"
										update="popup1 popup2 interruptAlarmTable " />
								</div>
							</div>
							<p:dataTable id="interruptAlarmTable" var="item"
								rowIndexVar="ite" widgetVar="interruptAlarmTable"
								selection="#{protectInterruptAlarmController.selected}"
								editable="true" editMode="cell"
								value="#{protectInterruptAlarmController.alarms}"
								rowKey="#{item.id}" style="margin-bottom:0" emptyMessage="无记录"
								rows="20" paginator="true" scrollable="true"
								paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
								rowsPerPageTemplate="20,50,100" paginatorPosition="bottom">
								<f:facet name="{Customization}">
									<p:outputLabel
										value="总计：#{protectInterruptAlarmController.alarms.size()} 条记录"
										style="margin-right:20px;"></p:outputLabel>
								</f:facet>
								<p:ajax event="rowSelectRadio"
									listener="#{protectInterruptAlarmController.onRowSelect}"
									update="form1:interruptAlarmTable" />
								<p:ajax event="cellEdit" oncomplete="onCellEdit()"
									listener="#{protectInterruptAlarmController.onCellEdit}" />
								<p:column selectionMode="single" width="10"
									style="text-align:center" />
								<p:column headerText="序号 " width="20">
									<h:outputText value="#{ite+1}" />
								</p:column>
								<p:column width="60" headerText="告警时间">
									<h:outputText value="#{item.eventStart}">
										<f:convertDateTime pattern="yyyy-MM-dd  HH:mm:ss" />
									</h:outputText>
									<!-- #{item.mStartMs} -->
									<h:outputText value="." rendered="#{item.mStartMs != null}" />
									<h:outputText value="#{item.mStartMs}"
										rendered="#{item.mStartMs != null}" />
								</p:column>
								<p:column width="40" headerText="电压等级"
									filterMatchMode="contains">
									<h:outputText value="#{item.voltage}" />
								</p:column>
								<p:column width="40" headerText="变电站名称">
									<h:outputText value="#{item.stationName}" />
								</p:column>
								<p:column width="50" headerText="线路名称">
									<h:outputText value="#{item.lineName}" />
								</p:column>
								<p:column width="40" headerText="保护类型"
									filterMatchMode="startsWith">
									<h:outputText value="#{item.protectType}" />
								</p:column>
								<p:column width="50" headerText="一次设备类型类型">
									<h:outputText value="#{item.protectedType}" />
								</p:column>
								<p:column width="50" headerText="告警信息">
									<h:outputText value="#{item.alarmMsg}" />
								</p:column>
								<p:column width="60" headerText="告警复归时间">
									<p:cellEditor>
										<f:facet name="output">
											<h:outputText value="#{item.revertTime}"
												rendered="#{item.revertTime != null}">
												<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
											</h:outputText>
											<h:outputText value="." rendered="#{item.revertTime != null}" />
											<h:outputText value="#{item.mReverMs}"
												rendered="#{item.revertTime != null}" />
											<h:outputText value="未复归"
												rendered="#{item.revertTime == null}" />
										</f:facet>
										<f:facet name="input">
											<p:calendar value="#{item.revertTime}" navigator="true"
												pattern="yyyy-MM-dd HH:mm:ss.SSS" showHour="true"
												showMinute="true" showSecond="true" showMillisec="true" />
										</f:facet>
									</p:cellEditor>
								</p:column>
								<p:column width="40" headerText="持续时间(ms)">
									<h:outputText
										value="#{item.durationTime > 0?item.durationTime:''}" />
								</p:column>
							</p:dataTable>
						</h:form>
					</div>
					<!-- 保护装置告警 -->
					<div id="ProtectDevice" class="chart tab-pane">
						<h:form id="form2">
							<div class="box box-solid with-border">
								<div class="box-header">
									<p:outputLabel for="popup13" value="告警时间：" />
									<p:calendar id="popup13" navigator="true"
										value="#{protectDeviceAlarmComtroller.queryDate1}"
										pattern="yyyy-MM-dd" maxdate="Date()">
										<p:ajax event="dateSelect"
											listener="#{protectDeviceAlarmComtroller.onDateSelectStart}" />
									</p:calendar>
									<p:outputLabel for="popup14" value="至 " />
									<p:calendar id="popup14" navigator="true"
										value="#{protectDeviceAlarmComtroller.queryDate2}"
										pattern="yyyy-MM-dd" maxdate="Date()">
										<p:ajax event="dateSelect"
											listener="#{protectDeviceAlarmComtroller.onDateSelectEnd}" />
									</p:calendar>
									<p:commandButton value="查询" id="query2"
										update="ProtectDeviceAlarm" icon="ui-icon-search"
										actionListener="#{protectDeviceAlarmComtroller.queryByTime}"
										style="margin-left:10px;" oncomplete="getTableScrollHeight();">
									</p:commandButton>
									<p:commandButton icon="ui-icon-refresh" value="重置"
										actionListener="#{protectDeviceAlarmComtroller.resetQuery}"
										style="margin-left:5px;" oncomplete="getTableScrollHeight();"
										update="popup13 popup14 ProtectDeviceAlarm " />
								</div>
							</div>
							<p:remoteCommand name="onCellEdit"
								update="form2:ProtectDeviceAlarm " />
							<p:dataTable id="ProtectDeviceAlarm" var="item"
								value="#{protectDeviceAlarmComtroller.protectDeviceAlarms}"
								rowKey="#{item.id}" style="margin-bottom:0" emptyMessage="无记录"
								rows="20" paginator="true" editable="true" editMode="cell"
								rowIndexVar="ite" scrollable="true"
								paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
								rowsPerPageTemplate="20,50,100" paginatorPosition="bottom">
								<f:facet name="{Customization}">
									<p:outputLabel
										value="总计：#{protectDeviceAlarmComtroller.protectDeviceAlarms.size()} 条记录"
										style="margin-right:20px;"></p:outputLabel>
								</f:facet>
								<p:ajax event="rowSelectRadio"
									listener="#{protectDeviceAlarmComtroller.onRowSelect}"
									update="form2:ProtectDeviceAlarm " />
								<p:ajax event="cellEdit" oncomplete="onCellEdit()"
									listener="#{protectDeviceAlarmComtroller.onCellEdit}" />
								<p:column selectionMode="single" width="10"
									style="text-align:center" />
								<p:column width="20" headerText="序号">
									<h:outputText value="#{ite+1}" />
								</p:column>
								<p:column width="60" headerText="变电站名称">
									<h:outputText value="#{item.stationName}" />
								</p:column>
								<p:column width="80" headerText="告警时间">
									<h:outputText value="#{item.eventStart}">
										<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
									</h:outputText>
									<!-- .#{item.mStartMs} -->
									<h:outputText value="." rendered="#{item.mStartMs != null}" />
									<h:outputText value="#{item.mStartMs}"
										rendered="#{item.mStartMs != null}" />
								</p:column>
								<p:column width="80" headerText="告警复归时间">
									<p:cellEditor>
										<f:facet name="output">
											<h:outputText value="#{item.revertTime}"
												rendered="#{item.revertTime != null}">
												<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
											</h:outputText>
											<h:outputText value="." rendered="#{item.revertTime != null}" />
											<h:outputText value="#{item.mReverMs}"
												rendered="#{item.revertTime != null}" />
											<h:outputText value="未复归"
												rendered="#{item.revertTime == null}" />
										</f:facet>
										<f:facet name="input">
											<p:calendar value="#{item.revertTime}" navigator="true"
												pattern="yyyy-MM-dd HH:mm:ss.SSS" showHour="true"
												showMinute="true" showSecond="true" showMillisec="true" />
										</f:facet>
									</p:cellEditor>
								</p:column>
								<p:column width="60" headerText="持续时间(ms)">
									<h:outputText
										value="#{item.durationTime > 0?item.durationTime:''}" />
								</p:column>
								<p:column width="60" headerText="告警名称">
									<h:outputText value="#{item.alarmMsg}" />
								</p:column>
								<p:column width="40" headerText="生产厂家">
									<h:outputText value="#{item.manufacturer}" />
								</p:column>
								<p:column width="60" headerText="保护名称">
									<h:outputText value="#{item.protectName}" />
								</p:column>
								<p:column width="60" headerText="保护类型">
									<h:outputText value="#{item.protectType}" />
								</p:column>
								<p:column width="40" headerText="主保护闭锁">
									<h:outputText
										styleClass="#{protectDeviceAlarmComtroller.getStyleClass(item.firstlock)}"
										value="#{protectDeviceAlarmComtroller.getLockText(item.firstlock)}" />
								</p:column>
								<p:column width="60" headerText="后备保护闭锁">
									<h:outputText
										styleClass="#{protectDeviceAlarmComtroller.getStyleClass(item.secondlock)}"
										value="#{protectDeviceAlarmComtroller.getLockText(item.secondlock)}" />
								</p:column>
								<p:column width="40" headerText="重合闸闭锁">
									<h:outputText
										styleClass="#{protectDeviceAlarmComtroller.getStyleClass(item.thirdlock)}"
										value="#{protectDeviceAlarmComtroller.getLockText(item.thirdlock)}" />
								</p:column>
							</p:dataTable>
						</h:form>
					</div>
					<!-- 通信通道告警 -->
					<div id="protectChannel" class="chart tab-pane">
						<h:form id="form3">
							<div class="box box-solid with-border">
								<div class="box-header">
									<p:outputLabel for="popup11" value="告警时间：" />
									<p:calendar id="popup11" navigator="true"
										value="#{protectChannelAlarmController.queryDate1}"
										pattern="yyyy-MM-dd" maxdate="Date()">
										<p:ajax event="dateSelect"
											listener="#{protectChannelAlarmController.onDateSelectStart}" />
									</p:calendar>
									<p:outputLabel for="popup12" value="至 " />
									<p:calendar id="popup12" navigator="true"
										value="#{protectChannelAlarmController.queryDate2}"
										pattern="yyyy-MM-dd" maxdate="Date()">
										<p:ajax event="dateSelect"
											listener="#{protectChannelAlarmController.onDateSelectEnd}" />
									</p:calendar>
									<p:commandButton value="查询" id="query2"
										update="protectChannelAlarm" icon="ui-icon-search"
										actionListener="#{protectChannelAlarmController.queryByTime}"
										style="margin-left:10px;" oncomplete="getTableScrollHeight();">
									</p:commandButton>
									<p:commandButton icon="ui-icon-refresh" value="重置"
										actionListener="#{protectChannelAlarmController.resetQuery}"
										style="margin-left:5px;" oncomplete="getTableScrollHeight();"
										update="popup11 popup12 protectChannelAlarm " />
								</div>
							</div>
							<p:dataTable id="protectChannelAlarm" var="item"
								value="#{protectChannelAlarmController.protectChannelAlarms}"
								rowKey="#{item.id}" emptyMessage="无记录" rows="20"
								paginator="true" rowIndexVar="ite" scrollable="true"
								paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
								rowsPerPageTemplate="20,50,100" paginatorPosition="bottom">
								<f:facet name="{Customization}">
									<p:outputLabel
										value="总计：#{protectChannelAlarmController.protectChannelAlarms.size()} 条记录"
										style="margin-right:20px;"></p:outputLabel>
								</f:facet>
								<p:column selectionMode="single" width="5"
									style="text-align:center" />
								<p:column width="20" headerText="序号">
									<h:outputText value="#{ite+1}" />
								</p:column>
								<p:column width="60" headerText="告警级别">
									<h:outputText value="#{item.level}" />
								</p:column>
								<p:column width="80" headerText="发生时间">
									<h:outputText value="#{item.triggerTime}">
										<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
									</h:outputText>
								</p:column>
								<p:column width="80" headerText="恢复时间">
									<h:outputText value="#{item.recoveryTime}">
										<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
									</h:outputText>
								</p:column>
								<p:column width="60" headerText="告警名称">
									<h:outputText value="#{item.name}" />
								</p:column>
								<p:column width="60" headerText="承载业务">
									<h:outputText value="#{item.alarmChannel}" />
								</p:column>
							</p:dataTable>
						</h:form>
					</div>
				</div>
			</div>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/js/tables/tabScrollTable.js" />
	</ui:define>
</ui:composition>
